.class public Lcom/zuiapps/sdk/analytics/util/ZMMD5Util;
.super Ljava/lang/Object;
.source "ZMMD5Util.java"


# static fields
.field static final hexDigits:[C


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 8
    const/16 v0, 0x10

    new-array v0, v0, [C

    fill-array-data v0, :array_a

    sput-object v0, Lcom/zuiapps/sdk/analytics/util/ZMMD5Util;->hexDigits:[C

    return-void

    :array_a
    .array-data 2
        0x30s
        0x31s
        0x32s
        0x33s
        0x34s
        0x35s
        0x36s
        0x37s
        0x38s
        0x39s
        0x61s
        0x62s
        0x63s
        0x64s
        0x65s
        0x66s
    .end array-data
.end method

.method public constructor <init>()V
    .registers 1

    .prologue
    .line 6
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static crypt(Ljava/lang/String;)Ljava/lang/String;
    .registers 2
    .param p0, "str"    # Ljava/lang/String;

    .prologue
    .line 18
    const-string v0, "UTF-8"

    invoke-static {p0, v0}, Lcom/zuiapps/sdk/analytics/util/ZMMD5Util;->crypt(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static crypt(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .registers 5
    .param p0, "str"    # Ljava/lang/String;
    .param p1, "charSet"    # Ljava/lang/String;

    .prologue
    .line 31
    if-eqz p0, :cond_a

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v1

    if-eqz v1, :cond_a

    if-nez p1, :cond_12

    .line 32
    :cond_a
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "String or charset to encript cannot be null or zero length"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 35
    :cond_12
    :try_start_12
    invoke-virtual {p0, p1}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v1

    invoke-static {v1}, Lcom/zuiapps/sdk/analytics/util/ZMMD5Util;->crypt([B)Ljava/lang/String;
    :try_end_19
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_12 .. :try_end_19} :catch_1b

    move-result-object v1

    return-object v1

    .line 36
    :catch_1b
    move-exception v0

    .line 37
    .local v0, "e":Ljava/io/UnsupportedEncodingException;
    new-instance v1, Ljava/lang/IllegalArgumentException;

    invoke-direct {v1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/Throwable;)V

    throw v1
.end method

.method public static crypt([B)Ljava/lang/String;
    .registers 12
    .param p0, "source"    # [B

    .prologue
    .line 49
    const/4 v6, 0x0

    .line 52
    .local v6, "s":Ljava/lang/String;
    :try_start_1
    const-string v9, "MD5"

    invoke-static {v9}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v5

    .line 53
    .local v5, "md":Ljava/security/MessageDigest;
    invoke-virtual {v5, p0}, Ljava/security/MessageDigest;->update([B)V

    .line 54
    invoke-virtual {v5}, Ljava/security/MessageDigest;->digest()[B

    move-result-object v8

    .line 55
    .local v8, "tmp":[B
    const/16 v9, 0x20

    new-array v7, v9, [C

    .line 56
    .local v7, "str":[C
    const/4 v3, 0x0

    .line 57
    .local v3, "k":I
    const/4 v2, 0x0

    .local v2, "i":I
    move v4, v3

    .end local v3    # "k":I
    .local v4, "k":I
    :goto_15
    const/16 v9, 0x10

    if-ge v2, v9, :cond_34

    .line 58
    aget-byte v0, v8, v2

    .line 59
    .local v0, "byte0":B
    add-int/lit8 v3, v4, 0x1

    .end local v4    # "k":I
    .restart local v3    # "k":I
    sget-object v9, Lcom/zuiapps/sdk/analytics/util/ZMMD5Util;->hexDigits:[C

    ushr-int/lit8 v10, v0, 0x4

    and-int/lit8 v10, v10, 0xf

    aget-char v9, v9, v10

    aput-char v9, v7, v4

    .line 61
    add-int/lit8 v4, v3, 0x1

    .end local v3    # "k":I
    .restart local v4    # "k":I
    sget-object v9, Lcom/zuiapps/sdk/analytics/util/ZMMD5Util;->hexDigits:[C

    and-int/lit8 v10, v0, 0xf

    aget-char v9, v9, v10

    aput-char v9, v7, v3

    .line 57
    add-int/lit8 v2, v2, 0x1

    goto :goto_15

    .line 63
    .end local v0    # "byte0":B
    :cond_34
    new-instance v6, Ljava/lang/String;

    .end local v6    # "s":Ljava/lang/String;
    invoke-direct {v6, v7}, Ljava/lang/String;-><init>([C)V
    :try_end_39
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_39} :catch_3a

    .line 68
    .restart local v6    # "s":Ljava/lang/String;
    return-object v6

    .line 65
    .end local v2    # "i":I
    .end local v4    # "k":I
    .end local v5    # "md":Ljava/security/MessageDigest;
    .end local v6    # "s":Ljava/lang/String;
    .end local v7    # "str":[C
    .end local v8    # "tmp":[B
    :catch_3a
    move-exception v1

    .line 66
    .local v1, "e":Ljava/lang/Exception;
    new-instance v9, Ljava/lang/IllegalArgumentException;

    invoke-direct {v9, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/Throwable;)V

    throw v9
.end method
